data.cor <- cor(county.Demo_and_Covid.allcounties[,-1], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
data.cor2 <- cor(county.Demo_and_Covid.500counties[,-c(1:2)], use = "complete.obs", method = "spearman")
corrplot.mixed(data.cor2, upper = 'ellipse', lower = 'number', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
corrplot.mixed(data.cor2[7:13,c(1:5, 14:42,6)], upper = 'ellipse', tl.pos = 'lt', tl.cex = 1, lower.col = "black", number.cex = 0.5)
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)", data = county.Demo_and_Covid.500counties)
## Warning: Some predictor variables are on very different scales: consider
## rescaling
## Warning: Some predictor variables are on very different scales: consider
## rescaling
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + Testing_Rate + Hospitalization_Rate + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -1274.3
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.2919 -0.3550 -0.0398 0.2656 5.7979
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000006157 0.002481
## Residual 0.000015378 0.003921
## Number of obs: 192, groups: stateID, 35
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -0.0113318282 0.0116504459 98.3669480205
## Affluence 0.0047923912 0.0011791283 144.8966850724
## Singletons.in.Tract 0.0009250241 0.0009995901 171.9703083064
## Seniors.in.Tract 0.0005272872 0.0012995747 171.8227636229
## African.Americans.in.Tract 0.0012353859 0.0011067942 171.9140817414
## Noncitizens.in.Tract 0.0016276525 0.0008513710 152.3349385176
## High.BP 0.0000158635 0.0002110896 156.3473087866
## Binge.Drinking 0.0003605972 0.0002021544 73.7103832564
## Cancer -0.0019924817 0.0012640503 147.0794138021
## Asthma 0.0001263159 0.0006814179 77.5949788382
## Heart.Disease 0.0029143503 0.0015807173 123.5877712327
## COPD -0.0002263934 0.0013009092 120.9490588077
## Smoking -0.0002042044 0.0002623405 138.3662234865
## Diabetes -0.0008197894 0.0006410012 126.0697103519
## No.Physical.Activity 0.0000503457 0.0002424726 136.0306027652
## Obesity 0.0003645168 0.0002016578 163.3544434967
## Poor.Sleeping.Habits 0.0000903992 0.0001827405 159.6688883982
## Poor.Mental.Health -0.0000522610 0.0005535499 50.8335905645
## Testing_Rate 0.0000007590 0.0000002951 45.6405760360
## Hospitalization_Rate -0.0001247906 0.0001211159 32.1085677074
## t value Pr(>|t|)
## (Intercept) -0.973 0.3331
## Affluence 4.064 0.0000787 ***
## Singletons.in.Tract 0.925 0.3561
## Seniors.in.Tract 0.406 0.6854
## African.Americans.in.Tract 1.116 0.2659
## Noncitizens.in.Tract 1.912 0.0578 .
## High.BP 0.075 0.9402
## Binge.Drinking 1.784 0.0786 .
## Cancer -1.576 0.1171
## Asthma 0.185 0.8534
## Heart.Disease 1.844 0.0676 .
## COPD -0.174 0.8621
## Smoking -0.778 0.4377
## Diabetes -1.279 0.2033
## No.Physical.Activity 0.208 0.8358
## Obesity 1.808 0.0725 .
## Poor.Sleeping.Habits 0.495 0.6215
## Poor.Mental.Health -0.094 0.9252
## Testing_Rate 2.572 0.0134 *
## Hospitalization_Rate -1.030 0.3105
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence 0.011
## Sngltns.n.T 0.022 0.068
## Snrs.n.Trct 0.472 0.344 0.189
## Afrcn.Am..T 0.123 0.147 -0.386 0.150
## Nnctzns.n.T -0.002 0.119 0.035 0.086 -0.128
## High.BP -0.079 0.261 0.018 0.072 -0.066 0.342
## Bing.Drnkng -0.393 -0.122 -0.277 -0.117 0.064 -0.018 0.130
## Cancer -0.553 -0.104 0.211 -0.250 -0.077 -0.083 -0.334 -0.051
## Asthma -0.412 -0.100 -0.265 -0.213 0.075 0.100 0.115 0.038 0.042
## Heart.Dises -0.183 0.062 -0.310 -0.174 0.249 -0.131 0.059 0.067 -0.488
## COPD 0.574 0.005 0.161 0.264 -0.044 0.240 0.067 0.026 -0.256
## Smoking -0.096 0.117 -0.177 -0.120 -0.044 0.069 -0.033 -0.278 0.082
## Diabetes 0.152 -0.382 -0.089 -0.192 -0.301 -0.235 -0.554 0.039 0.237
## N.Physcl.Ac -0.211 0.069 0.110 0.015 -0.019 -0.218 -0.008 0.118 0.442
## Obesity -0.025 0.379 0.478 0.283 0.104 0.162 -0.100 -0.187 0.116
## Pr.Slpng.Hb -0.407 -0.393 0.111 -0.325 -0.278 -0.070 -0.185 0.109 0.094
## Pr.Mntl.Hlt -0.365 0.224 -0.053 -0.027 0.071 -0.120 0.026 0.122 0.350
## Testing_Rat 0.221 -0.132 0.027 0.019 0.016 -0.027 -0.038 -0.075 -0.171
## Hsptlztn_Rt -0.116 -0.130 -0.052 -0.165 -0.053 -0.075 -0.037 -0.079 -0.071
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H Pr.M.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.326
## COPD -0.408 -0.581
## Smoking 0.105 0.173 -0.464
## Diabetes -0.141 -0.360 0.009 0.212
## N.Physcl.Ac 0.066 -0.347 -0.011 -0.289 -0.163
## Obesity -0.211 -0.088 0.150 -0.253 -0.369 -0.003
## Pr.Slpng.Hb 0.089 0.257 -0.159 -0.080 -0.034 -0.157 -0.138
## Pr.Mntl.Hlt -0.254 0.076 -0.454 0.023 -0.009 0.002 0.022 -0.127
## Testing_Rat -0.298 -0.086 0.238 0.099 0.138 -0.288 0.087 -0.126 -0.145
## Hsptlztn_Rt 0.045 0.152 -0.104 0.060 -0.024 -0.005 0.013 0.007 -0.093
## Tstn_R
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises
## COPD
## Smoking
## Diabetes
## N.Physcl.Ac
## Obesity
## Pr.Slpng.Hb
## Pr.Mntl.Hlt
## Testing_Rat
## Hsptlztn_Rt 0.080
## fit warnings:
## Some predictor variables are on very different scales: consider rescaling
this.lme <- lmer("total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)", data = county.Demo_and_Covid.500counties)
print(summary(this.lme), correlation=TRUE)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## "total.cases.percap ~ Affluence + Singletons.in.Tract + Seniors.in.Tract + African.Americans.in.Tract + Noncitizens.in.Tract + High.BP + Binge.Drinking + Cancer + Asthma + Heart.Disease + COPD + Smoking + Diabetes + No.Physical.Activity + Obesity + Poor.Sleeping.Habits + Poor.Mental.Health + (1 | stateID)"
## Data: county.Demo_and_Covid.500counties
##
## REML criterion at convergence: -2427.1
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.8334 -0.3825 -0.0836 0.2882 6.5084
##
## Random effects:
## Groups Name Variance Std.Dev.
## stateID (Intercept) 0.000007872 0.002806
## Residual 0.000013290 0.003646
## Number of obs: 326, groups: stateID, 51
##
## Fixed effects:
## Estimate Std. Error df t value
## (Intercept) -0.02422838 0.00816912 192.13945306 -2.966
## Affluence 0.00306783 0.00074268 302.01017953 4.131
## Singletons.in.Tract 0.00073208 0.00069388 301.27617807 1.055
## Seniors.in.Tract 0.00023558 0.00087633 304.64315604 0.269
## African.Americans.in.Tract 0.00193767 0.00084699 306.90000915 2.288
## Noncitizens.in.Tract 0.00189600 0.00068268 270.97498421 2.777
## High.BP -0.00003196 0.00015324 298.31315117 -0.209
## Binge.Drinking 0.00040621 0.00016076 158.14883530 2.527
## Cancer -0.00028148 0.00089839 265.63184646 -0.313
## Asthma 0.00086186 0.00053271 140.79048500 1.618
## Heart.Disease 0.00320794 0.00115189 209.68523086 2.785
## COPD -0.00137576 0.00087194 204.29695038 -1.578
## Smoking -0.00019795 0.00020166 249.76729692 -0.982
## Diabetes -0.00114700 0.00043226 268.25920226 -2.653
## No.Physical.Activity 0.00031914 0.00017356 236.62271103 1.839
## Obesity 0.00025681 0.00014071 307.98586543 1.825
## Poor.Sleeping.Habits 0.00023748 0.00013543 296.98036928 1.754
## Poor.Mental.Health -0.00014904 0.00045166 103.08747962 -0.330
## Pr(>|t|)
## (Intercept) 0.00340 **
## Affluence 0.0000469 ***
## Singletons.in.Tract 0.29225
## Seniors.in.Tract 0.78825
## African.Americans.in.Tract 0.02284 *
## Noncitizens.in.Tract 0.00586 **
## High.BP 0.83493
## Binge.Drinking 0.01249 *
## Cancer 0.75429
## Asthma 0.10793
## Heart.Disease 0.00584 **
## COPD 0.11615
## Smoking 0.32725
## Diabetes 0.00844 **
## No.Physical.Activity 0.06720 .
## Obesity 0.06896 .
## Poor.Sleeping.Habits 0.08054 .
## Poor.Mental.Health 0.74209
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of fixed effects could have been required in summary()
##
## Correlation of Fixed Effects:
## (Intr) Afflnc Sng..T Snr..T A.A..T Nnc..T Hgh.BP Bng.Dr Cancer
## Affluence -0.049
## Sngltns.n.T -0.056 0.043
## Snrs.n.Trct 0.396 0.293 0.073
## Afrcn.Am..T 0.242 0.076 -0.405 0.202
## Nnctzns.n.T -0.072 0.153 0.125 0.057 -0.190
## High.BP -0.095 0.157 0.099 0.007 -0.234 0.328
## Bing.Drnkng -0.487 -0.041 -0.205 -0.069 0.042 -0.076 0.149
## Cancer -0.495 -0.095 0.231 -0.173 -0.073 -0.067 -0.329 -0.020
## Asthma -0.268 -0.097 -0.262 -0.121 -0.013 0.211 0.053 0.007 -0.158
## Heart.Dises -0.058 0.076 -0.301 -0.132 0.213 -0.054 -0.001 0.034 -0.602
## COPD 0.479 0.011 0.128 0.172 -0.005 0.156 0.059 0.060 -0.213
## Smoking -0.044 0.105 -0.119 -0.137 -0.105 0.159 -0.083 -0.327 0.158
## Diabetes 0.036 -0.301 -0.079 -0.133 -0.230 -0.254 -0.445 0.075 0.366
## N.Physcl.Ac -0.116 0.034 0.101 0.079 0.059 -0.274 0.004 0.125 0.337
## Obesity -0.065 0.383 0.398 0.202 0.133 0.194 -0.103 -0.148 0.119
## Pr.Slpng.Hb -0.385 -0.351 0.162 -0.326 -0.322 -0.046 -0.156 0.087 0.028
## Pr.Mntl.Hlt -0.354 0.183 -0.007 0.021 0.051 -0.165 0.027 0.131 0.417
## Asthma Hrt.Ds COPD Smokng Diabts N.Ph.A Obesty Pr.S.H
## Affluence
## Sngltns.n.T
## Snrs.n.Trct
## Afrcn.Am..T
## Nnctzns.n.T
## High.BP
## Bing.Drnkng
## Cancer
## Asthma
## Heart.Dises 0.336
## COPD -0.323 -0.490
## Smoking 0.144 0.082 -0.476
## Diabetes -0.106 -0.431 -0.009 0.278
## N.Physcl.Ac -0.023 -0.361 0.087 -0.274 -0.169
## Obesity -0.127 -0.021 0.091 -0.220 -0.376 -0.045
## Pr.Slpng.Hb 0.000 0.240 -0.093 -0.167 -0.060 -0.154 -0.115
## Pr.Mntl.Hlt -0.437 -0.066 -0.389 -0.028 0.072 -0.084 0.026 -0.082
testing.data.state <- compiled.stats[[length(daily_filenames)]][, c("Province_State", "Testing_Rate")]
testing.data.state <- testing.data.state[!is.na(testing.data.state$Testing_Rate),]
testing.data.state <- testing.data.state[order(testing.data.state$Testing_Rate),]
col.state <- rep("pink", nrow(testing.data.state))
avg.test.rate <- mean(testing.data.state$Testing_Rate, na.rm = T)
col.state[testing.data.state$Testing_Rate < avg.test.rate] <- "grey"
col.state[testing.data.state$Province_State == "Oklahoma"] <- "lightblue"
par(mar = c(5,6,4,2))
barplot(testing.data.state$Testing_Rate, names.arg = testing.data.state$Province_State, horiz = T, main = "Testing Rate by State", las = 2, cex.axis = 1, cex.names = 0.5, col = col.state, border = F, xlab = "Total number of people tested per 100,000 persons.")
abline(v = avg.test.rate, col = "red")
text(x = avg.test.rate + 10, y = 1, labels = "Average Testing Rate", adj = c(0, 0.5), col = "red")
Pink highlights the last 14 days.
day.first.case <- min(which(US.total$cases.total > 100))
n.days <- nrow(US.total)
twoweek.col <- c(rep("grey", n.days-day.first.case-13), rep("pink", 14))
par(mar = c(5,5,4,2))
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 cases by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Total COVID-19 deaths by Date in US, log scale",
las = 2, cex.axis = 1, cex.names = 0.5, log = "y",
col = twoweek.col, border = F)
barplot(US.total$rise.cases.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Cases of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)
barplot(US.total$rise.deaths.total[day.first.case:n.days],
names = US.total$day[day.first.case:n.days],
main = "Rise in Deaths of COVID-19 by Date in US",
las = 2, cex.axis = 1, cex.names = 0.5,
col = twoweek.col, border = F)